#include "Shm.hpp"
#include <unistd.h>

int main()
{
    Shm shmfifo;
    shmfifo.getShm();
    shmfifo.attach();

    //对共享内存进行输入
    //直接对地址输入即可
    int index = 0;
    char* address = (char*)shmfifo.get_address();
    int size = shmfifo.getSize();
    shmfifo.getStruct();//获取属性
    while(1)
    {
        char ch;
        std::cin >> ch;
        address[index++] = ch;

        index %= size;
    }
    sleep(20);
    shmfifo.detach();
    return 0;
}